<!doctype html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title th:text="${text}">Heron</title>
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <meta name="msapplication-TileColor" content="#206bc4"/>
    <meta name="theme-color" content="#206bc4"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="mobile-web-app-capable" content="yes"/>
    <meta name="HandheldFriendly" content="True"/>
    <meta name="MobileOptimized" content="320"/>
    <meta name="robots" content="noindex,nofollow,noarchive"/>
    <!-- CSS files -->
    <link href="/dist/css/tabler.min.css" rel="stylesheet"/>
    <link href="/dist/css/demo.min.css" rel="stylesheet"/>
    <link href="/dist/css/bootstrap-table.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.6.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            display: none;
        }
    </style>
</head>
<body class="antialiased">
<div class="page">
    <header class="navbar navbar-expand-md navbar-light">
        <div class="container-fluid">
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu">
                <span class="navbar-toggler-icon"></span>
            </button>
            <a href="/" class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pr-0 pr-md-3">
                <img src="./static/logo.svg" th:src="@{/static/logo.svg}" alt="Tabler"
                     class="navbar-brand-image">
            </a>
            <div class="navbar-nav flex-row order-md-last">
                <div class="nav-item dropdown">
                    <a href="#" class="nav-link d-flex lh-1 text-reset p-0" data-toggle="dropdown">
                        <div th:switch="${session.currentUser.avatar == '' or session.currentUser.avatar == null}">
                                                                    <span class="avatar avatar-md" th:case="true"><svg
                                                                            xmlns="http://www.w3.org/2000/svg"
                                                                            class="icon icon-md" width="24"
                                                                            height="24" viewBox="0 0 24 24"
                                                                            stroke-width="2" stroke="currentColor"
                                                                            fill="none" stroke-linecap="round"
                                                                            stroke-linejoin="round"><path
                                                                            stroke="none" d="M0 0h24v24H0z"></path><circle
                                                                            cx="12" cy="7"
                                                                            r="4"></circle><path
                                                                            d="M5.5 21v-2a4 4 0 0 1 4 -4h5a4 4 0 0 1 4 4v2"></path></svg></span>
                            <span class="avatar avatar-md" th:case="false"
                                  th:style="'background-image:url('+${session.currentUser.avatar}+')'"></span>
                        </div>
                        <div class="d-none d-xl-block pl-2">
                            <div th:text="${session.currentUser.account}">Paweł Kuna</div>
                            <div class="mt-1 small text-muted" th:text="${session.currentUser.eMail}">UI
                                Designer
                            </div>
                        </div>
                    </a>
                </div>
                <div class="nav-item" style="margin-left: 20px;margin-right: 20px">
                    <a href="/logout">
                        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-md" width="24" height="24"
                             viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
                             stroke-linecap="round" stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z"></path>
                            <path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"></path>
                            <path d="M7 12h14l-3 -3m0 6l3 -3"></path>
                        </svg>
                        退出
                    </a>
                </div>
            </div>
        </div>
    </header>
    <!--导航栏-->
    <div class="navbar-expand-md">
        <div class="collapse navbar-collapse" id="navbar-menu">
            <div class="navbar navbar-light">
                <div class="container-fluid">
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a class="nav-link" href="/index">
                                        <span class="nav-link-icon d-md-none d-lg-inline-block">
                                            <svg xmlns="http://www.w3.org/2000/svg"
                                                 class="icon" width="24" height="24"
                                                 viewBox="0 0 24 24" stroke-width="2"
                                                 stroke="currentColor" fill="none"
                                                 stroke-linecap="round"
                                                 stroke-linejoin="round">
                                                <path
                                                        stroke="none" d="M0 0h24v24H0z"/>
                                                <polyline points="5 12 3 12 12 3 21 12 19 12"/>
                                                <path
                                                        d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"/>
                                                <path
                                                        d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"/>
                                            </svg>
                                        </span>
                                <span class="nav-link-title">
                                            首页
                                        </span>
                            </a>
                        </li>
                        <li class="nav-item" th:each="menu:${menus}"
                            th:classappend="${menu.child == null} ? '' : dropdown"
                            th:switch="${menu.child != null}">
                            <a th:case="true" class="nav-link dropdown-toggle" data-toggle="dropdown"
                               role="button"
                               aria-expanded="false">
                                <span class="nav-link-icon d-md-none d-lg-inline-block"></span>
                                <span class="nav-link-title" th:text="${menu.menuName}"></span>
                            </a>
                            <a th:case="false" class="nav-link"
                               th:href="@{{url}(url=${menu.url}, menuName=${menu.menuName})}">
                                <span class="nav-link-icon d-md-none d-lg-inline-block"></span>
                                <span class="nav-link-title" th:text="${menu.menuName}"></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-columns dropdown-menu-columns-2"
                                th:if="${menu.child != null}">
                                <li th:each="item:${menu.child}">
                                    <a class="dropdown-item"
                                       th:href="@{{url}(url=${item.url}, menuName=${item.menuName})}"
                                       th:text="${item.menuName}"></a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!--主体table-->
    <div class="content">
        <div class="container-fluid">
            <!-- Page title -->
            <div class="page-header">
                <div class="row align-items-center">
                    <div class="col-auto">
                        <h2 class="page-title" th:text="${text}"></h2>
                    </div>
                </div>
            </div>
            <div class="card">
                <div class="table-responsive" style="padding: 10px">
                    <div id="toolbar">
                        <shiro:hasPermission name="sys:role:add">
                            <button class="btn btn-primary role_add">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-md" width="24" height="24"
                                     viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
                                     stroke-linecap="round" stroke-linejoin="round">
                                    <path stroke="none" d="M0 0h24v24H0z"></path>
                                    <line x1="12" y1="5" x2="12" y2="19"></line>
                                    <line x1="5" y1="12" x2="19" y2="12"></line>
                                </svg>
                                新增
                            </button>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="sys:role:alter">
                            <button class="btn btn-primary role_edit">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-md" width="24" height="24"
                                     viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
                                     stroke-linecap="round" stroke-linejoin="round">
                                    <path stroke="none" d="M0 0h24v24H0z"></path>
                                    <path d="M4 20h4l10.5 -10.5a1.5 1.5 0 0 0 -4 -4l-10.5 10.5v4"></path>
                                    <line x1="13.5" y1="6.5" x2="17.5" y2="10.5"></line>
                                </svg>
                                编辑
                            </button>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="sys:role:del">
                            <button class="btn btn-primary role_del">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-md" width="24" height="24"
                                     viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
                                     stroke-linecap="round" stroke-linejoin="round">
                                    <path stroke="none" d="M0 0h24v24H0z"></path>
                                    <line x1="4" y1="7" x2="20" y2="7"></line>
                                    <line x1="10" y1="11" x2="10" y2="17"></line>
                                    <line x1="14" y1="11" x2="14" y2="17"></line>
                                    <path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path>
                                    <path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>
                                </svg>
                                删除
                            </button>
                        </shiro:hasPermission>
                    </div>
                    <table id="role_table" data-toolbar="#toolbar" class="table table-striped table-bordered"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Libs JS -->
<script src="https://cdn.staticfile.org/jquery/1.10.0/jquery.min.js"></script>
<script src="/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="/dist/js/bootstrap-table.min.js"></script>
<script src="/dist/js/bootstrap-table-zh-CN.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js"></script>
<script src="/dist/js/tabler.min.js"></script>
<script src="/dist/js/base.js"></script>
<script>
    document.body.style.display = "block";
    var $table = $('#role_table')
    $(document).ready(function () {
        $table.bootstrapTable({
            url: '/logs/pageInfo',
            pagination: true,
            sortable: false,
            locale: 'zh-CN',
            virtualScroll: true,
            totalField: 'total',
            dataField: 'list',
            sidePagination: 'server',
            search: false,
            pageSize: 5,
            pageList: [5, 10, 20, 50, 100],
            buttonsAlign: 'left',
            idField: 'id',
            showRefresh: false,
            // height: 500,
            columns: [{radio: true}, {
                field: 'account',
                title: '账户名'
            }, {
                field: 'ip',
                title: 'IP地址'
            }, {
                field: 'time',
                title: '登录时间'
            }]
        });
    });
</script>
</body>
</html>
